package com.htu.config;

import org.springframework.stereotype.Component;

import java.io.FileWriter;
import java.io.IOException;

@Component
public class AlipayConfig
{

//↓↓↓↓↓↓↓↓↓↓请在这里配置您的基本信息↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

    // 应用ID,您的APPID，收款账号既是您的APPID对应支付宝账号
    public static String app_id = "2021000119651427";

    // 商户私钥，您的PKCS8格式RSA2私钥
    public static String merchant_private_key = "MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCS4JXdLwQBhT6cwfulRQjKs9GTTaFNxX6a6xNGqoUEWtym+0NbgKqHLtAB7VxhB13e2IruzYyOLSx3w2P5Fm3meEGkhb4HBXBDUiX5QeKH2J1jnGQx9lMYmyWzyoUuxfm+D1h6iln+PRkOL/gC2GrkbTE0iKYc5bs0l7J5mZ0BxQJQJb9h//7vMNOMkB4G+fBQvkwHM/nM3EPoibA93qNtNFZ8cnJbyTaioVZzBT9fSOcbwnxZUrjZUdq5xLqUZGjKID/fXbCwCCnQOwqTRlxzEohcLCIklPyu1XYZRO9kR/NqPUkOQoZEk9Xc4POaNwgoUMUmTjnAQn4xrtaIJAQHAgMBAAECggEBAIZfvfwLpYiWlL/poQaE8BQzC0vOvAJg6wFki9Ac9XEUh8alHey6/EiNBXSd6eRDTxgv2Hu9xhfVMFephO9AG++8maGhUkcuLJUKtP8jzdIm1Wdqjyg+iat7VbT1VX+DVIcTlwkVRlwZHbEjJa3EvZaaZ2f+lKrfarQlDP2/Eiuo4Vg/oc8BDpfgjBf3uJBl6I8GxSSveuj8tkJUCNfV3xFkj+yvr0SomE8Tw+zeEP51mJqcGMI/l4v32+dKUKpeEMqjiZEZ6HguFz2HqhjDLSiO2fWzKotCrW4YX/9ZmHy11T6UzwseOwE6CzzS1980BumvkE51whNHznMCJIADhAECgYEA4LA6ErWGKg+vJ5CVrSKv5cv1Sh6XeL7CArY+yLfHg0s07w89rVjgrPdQ1C6ZAIB+KQh6G+a9Jp6bOu0nmxzPeGnJeHlHWihoQmvnO5dXL0CLn2d4e1xPFH/W/EWl1QcuA6FhwC93W5VtCyrAzlexiLW28e4Kemx9uxwtIflhUQECgYEAp1hxQTQrnyglRJ9NS6966FCUJf1TNoNxXg4M7frlgh2yCEApthvaLda+v0CY5fK8vfRz6+BAzWZtu7Npz3WbKL/19ZXOop+KdKI7x88soDKJFdYMo3v8d0gz8tsAToDfAc8vWX6XxKIZVyNdckAFF3uXOqo2glf0D/xN/BudzQcCgYBR6W0CbRLgOp+MOPWYDNE7YUOnJcfqyQBJpM72takSgFRn4pKFo6Uk6XSaJfK5cB6OLvz1NwU2ExRcQyDxN2ubZlWAihYtFBYOQPAnlWC/ZTSBhGMz9c8Olhx2E54FL3zi7e6I9cT5qlv6ejeYAfhC8pwjTribMPoVQIxjmlqUAQKBgECAsZ7Naib9xWeu849Bw2E6dfAytdlkTtVPGyK7u60snwvZF3rPP4i9pmZ3krfHmYKqb+gyVygU3CUmYZmKnlTVsQuJQ82hKzALvHkm3O+eqwJUsChvyP99QDDSw0p/F/ZNktWvGva6+IOC6Sj5jjzf8Ym2RC53kmZ6/OA5ENkPAoGBAKrOIm46gWW7L3JSrqVAlDGg2gGsB413zK+12vP6K4af+BvYgSkadYGV9nkEdhsjr+GASd2sf7H3iWvCeZrnnYx0armfAXmD3pvaKKpIcynDvN0dCo2GNffcnIHmwV+cejkYDXpcE2T2rhTgzgrDbzZ9nr/puKuCRu1TugsN1NDf";

    // 支付宝公钥,查看地址：https://openhome.alipay.com/platform/keyManage.htm 对应APPID下的支付宝公钥。
    public static String alipay_public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAjP+77n1pbhf74+yZ64Ba6IzLEmbCD+tta+WiHtlmQzt0lOdJhupHwtv/vNGKr59+KTbS97sy33uXUO5PHW0n7kjulbqygiQ1j83CL9c3Aqm02sILc0LVZXzVw2QrUDHf5tgKtx7P69wHd0Vu6ap+AIjeWAr01JiZaIRXrU4dlKqN3Tgy6IyEu7PMbzVh2cRAms9Y23Tl4Pdpo76pO/GNWDgEPDx5egJlpbcnbEcTiMnxEHsc1zghWf5LaTgAP7SxWpzdk0xoAlJuhTYHoP4IZ+sJ7PWsWKjEzCekFbO7OVnRJKi0bBzpaSLC9xGmqKY+ppbjpKT6IazR57G69OEiYwIDAQAB";

    // 服务器异步通知页面路径  需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
    public static String notify_url = "http://ngrok.sscai.club/alipay_trade_wap_pay_java_utf_8_war_exploded/notify_url.jsp";

    // 页面跳转同步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
    public static String return_url = "http://ngrok.sscai.club/alipay_trade_wap_pay_java_utf_8_war_exploded/return_url.jsp";

    // 签名方式
    public static String sign_type = "RSA2";

    // 字符编码格式
    public static String charset = "utf-8";

    // 支付宝网关
    public static String gatewayUrl = "https://openapi.alipaydev.com/gateway.do";

    // 支付宝网关
    public static String log_path = "C:\\";


//↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

    /**
     * 写日志，方便测试（看网站需求，也可以改成把记录存入数据库）
     *
     * @param sWord 要写入日志里的文本内容
     */
    public static void logResult(String sWord)
    {
        FileWriter writer = null;
        try
        {
            writer = new FileWriter(log_path + "alipay_log_" + System.currentTimeMillis() + ".txt");
            writer.write(sWord);
        } catch (Exception e)
        {
            e.printStackTrace();
        } finally
        {
            if (writer != null)
            {
                try
                {
                    writer.close();
                } catch (IOException e)
                {
                    e.printStackTrace();
                }
            }
        }
    }
}


